﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;
namespace BHair.Base
{
    public partial class 退卡提示 : Form
    {
        public 退卡提示()
        {
            InitializeComponent();
        }
        string constr = ConfigurationManager.ConnectionStrings["BHair.Properties.Settings.BHairDBConnectionString"].ConnectionString;
        private void button1_Click(object sender, EventArgs e)
        {
            if (checkBox1.Checked == true)
            {
                //回收卡
                //修改已经退卡的卡片卡号
                string sql =string.Format("UPDATE [member] SET [mid] = '*****',mstatus=1  WHERE mid='{0}'", chuanzhi.tkcard);
                SqlConnection conn = new SqlConnection(constr);
                conn.Open();
                SqlCommand comm = new SqlCommand(sql,conn);
                comm.ExecuteNonQuery();
                //修改制卡表
                string sql1 =string.Format( "UPDATE [制卡] SET [fl] = 1 WHERE card='{0}'",chuanzhi.tkcard);
                SqlConnection conn1 = new SqlConnection(constr);
                conn1.Open();
                SqlCommand comm1 = new SqlCommand(sql1,conn1);
                comm1.ExecuteNonQuery();
                MessageBox.Show("回收卡成功");
                conn.Close();
                conn1.Close();
                this.Close();
            }
            else if (checkBox2.Checked == true)
            {
                //退卡
                this.Close();
            }
            else
            {
                MessageBox.Show("请选择退卡方式");
            }
        }
    }
}
